package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.bumptech.glide.Glide;
import com.lwj.liwanjia.R;
import com.lwj.liwanjia.utils.ImageSizeUtils;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;

import java.util.List;

/**
 * 商品介绍
 */

public class ShangpinJiesaoAdapter extends SuperBaseAdapter<String> {
    private Context mContext;
    private int imgHeight;
    private int imgWidth;

    public ShangpinJiesaoAdapter(Context context, List<String> data, int imgWidth, int imgHeight) {
        super(context, data);
        mContext = context;
        this.imgHeight = imgHeight;
        this.imgWidth = imgWidth;
    }

    @Override
    protected void convert(BaseViewHolder holder, String item, int position) {
        ImageView view = (ImageView) holder.getView(R.id.detail_image);
        view.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ImageSizeUtils.getImageHight(mContext, imgWidth, imgHeight)));
        Glide.with(mContext).load(item).into(view);
    }

    @Override
    protected int getItemViewLayoutId(int position, String item) {
        return R.layout.miaoshu_item_image;
    }

}
